package com.view.loadmore

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ProgressBar
import android.widget.TextView
import com.chad.library.adapter.base.loadmore.BaseLoadMoreView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.view.R

/**
 * @describe:
 * @Author: lixiaopeng
 * @Date: 2020/7/10
 */
class LoadMoreView : BaseLoadMoreView(){

    override fun getLoadComplete(holder: BaseViewHolder): View {
        val textView = holder.getView<TextView>(R.id.loadmoreTitle)
        textView.text = textView.context.getString(R.string.brvah_load_complete)
        return textView
    }

    override fun getLoadEndView(holder: BaseViewHolder): View {
        val textView = holder.getView<TextView>(R.id.loadmoreTitle)
        textView.text = textView.context.getString(R.string.brvah_load_end)
        return textView
    }

    override fun getLoadFailView(holder: BaseViewHolder): View {
        val textView = holder.getView<TextView>(R.id.loadmoreTitle)
        textView.text = textView.context.getString(R.string.brvah_load_failed)
        return textView
    }

    override fun getLoadingView(holder: BaseViewHolder): View {
        return holder.getView<ProgressBar>(R.id.loadmore)
    }

    override fun getRootView(parent: ViewGroup): View {
        return LayoutInflater.from(parent.context).inflate(R.layout.layout_loadmore, parent, false)
    }


}